#include <cstdio>

int gcd(int a, int b);

int main(int argc, char const *argv[]){
    int a, b;
    while (scanf("%d%d", &a, &b) != EOF)
        printf("%d\n", gcd(a,b));
    return 0;
}

int gcd(int a, int b){
    if (b == 0)
        return a;
    else 
        return gcd(b, a % b);
}

/*

int gcd(int a, int b){
    return b != 0 ? gcd(b, a % b) : a;
}
 
int gcd(int a, int b){
    while (b != 0){
        int temp = a % b;
        a = b;
        b = temp;
    }
    return a;
}
*/